<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>制证审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/iconfont.css">
    <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">

    <link rel="stylesheet" href="../css/xadmin.css">
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script src="../js/base.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        tr td,
        tr th {
            text-align: center !important;
            border: none !important;
        }

        .layui-laydate-content tr td {
            border-bottom: none !important;
            border-top: none !important;
        }

        tr td {
            border-bottom: 1px solid #eee !important;
            border-top: 1px solid #eee !important;
        }

        .search.active {
            background: #3DB6FE;
            color: #fff;
        }

        .search.active:hover {
            color: #fff !important;
        }
    </style>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card" style="display: flex;justify-content: space-between;">
                    <div class="layui-card-body ">
                        <blockquote class="layui-elem-quote" style="border:0;font-size: 18px;color: #000;">制证审核
                        </blockquote>
                    </div>
                </div>
            </div>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <!-- <div class="layui-card-header">数据统计</div> -->
                    <div class="layui-fluid">
                        <div class="layui-row layui-col-space15">
                            <div class="layui-col-md12">
                                <div class="layui-card-body " style="display: flex;justify-content:space-between">
                                    <form class="layui-form" action="">
                                        <!-- <label>真实姓名</label> -->
                                        <div class="layui-inline layui-show-xs-block" style="width:120px">
                                            <input class="layui-input" id="name" placeholder="请输入真实姓名" type="text">
                                        </div>
                                        <!-- 市/区联动 -->
                                        <!-- <div class="layui-inline layui-show-xs-block" style="width: 120px;">
                                            <select id="s_province" name="s_province" lay-filter="s_province">
                                            </select>
                                        </div>
                                        <div class="layui-inline layui-show-xs-block" style="width: 120px;">
                                            <select id="s_city" name="s_city" lay-filter="s_city">
                                            </select>
                                        </div> -->
                                        <div class="layui-inline layui-show-xs-block" style="width: 120px;">
                                            <select name="level" id="level" lay-filter="level" lay-search>
                                                <option value="">请选择等级</option>
                                                <option value="1">1级</option>
                                                <option value="2">2级</option>
                                                <option value="3">3级</option>
                                                <option value="4">4级</option>
                                                <option value="5">5级</option>
                                                <option value="6">6级</option>
                                                <option value="7">7级</option>
                                                <option value="8">8级</option>
                                                <option value="9">9级</option>
                                                <option value="10">10级</option>
                                            </select>
                                        </div>
                                        <div class="layui-inline layui-show-xs-block" style="width: 120px;">
                                            <select name="fundStatus" id="fundStatus" lay-filter="fundStatus"
                                                lay-search>
                                                <option value="">请选择审核状态</option>
                                                <option value="1">等待审批</option>
                                                <option value="3">制证中</option>
                                                <option value="4">快递中</option>
                                                <option value="9">审核拒绝</option>
                                            </select>
                                        </div>
                                        <!-- <div class="layui-inline layui-show-xs-block"
                                            style="margin-left: 5px;width: 120px;">
                                            <input id="startTime" name="startTime" placeholder="起始时间"
                                                class="layui-input">
                                        </div>
                                        <div class="layui-inline layui-show-xs-block"
                                            style="margin-left: 5px;width: 120px;">
                                            <input id="endTime" name="endTime" placeholder="结束时间" class="layui-input">
                                        </div> -->
                                        <div class="layui-inline layui-show-xs-block">
                                            <button class="layui-btn search" data-type="reload" lay-filter="add">搜索
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card-body layui-table-body layui-table-main">
                <!-- 表格部分开始 -->
                <table id="application_table" lay-filter="test" lay-data="{id: 'testReload'}"></table>
                <script type="text/html" id="barDemo">
                    {{#  if(d.status =="1"){ }}
                    <a lay-event="edit1" class="btn_a layui-btn layui-btn-xs">审批</a>
                    {{#  } }}
                    {{#  if(d.status =="3"){ }}
                    <a lay-event="edit3" class="btn_a layui-btn layui-btn-xs">发货</a>
                    {{#  } }}
                    {{#  if(d.status =="4"){ }}
                    <a lay-event="edit4" class="btn_a layui-btn layui-btn-xs">电子证书</a>
                    {{#  } }}
                    {{#  if(d.status =="9"){ }}
                    {{#  } }}
                </script>
                <!-- 表格结束 -->
            </div>
        </div>
    </div>
    </div>
</body>

</html>
<script src="../js/area2.js"></script>
<script>
    // _init_area(); //市区联动初始函数
    layui.use(['table', 'laydate', 'form'], function () {
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;

        var index = layer.load(1); //添加laoding,0-2两种方式
        // form.on('select(s_province)', function (data) {
        //     change(1);
        //     form.render('select');
        // });
        // form.on('select(s_city)', function (data) {
        //     change(2);
        //     form.render('select');
        // });

        // var date1 = laydate.render({
        //     elem: '#startTime',
        //     type: 'date'
        // })
        // var date2 = laydate.render({
        //     elem: '#endTime',
        //     type: 'date'
        // })

        //第一个实例
        var ins1 = table.render({
            elem: '#application_table', //指定原始表格元素选择器（推荐id选择器）
            // height: 600,
            width: "100%",
            // 附加参数，post token
            // where: {
            //     'examineStatus': 0
            // },
            toolbar: true,
            defaultToolbar: ['exports', {
                title: '提示' //标题
                    ,
                layEvent: 'LAYTABLE_TIPS' //事件名，用于 toolbar 事件中使用
                    ,
                icon: 'layui-icon-tips' //图标类名
            }],
            loading: true,
            method: 'get',
            url: findExamineFootballCertificateList, //数据接口
            page: true, //开启分页
            cols: [
                [ //表头
                    // { type: 'checkbox', fixed: 'left' },
                    {
                        field: 'id',
                        title: 'ID',
                        width: 150
                    },
                    {
                        field: 'name',
                        title: '真实姓名',
                        width: 150
                    },
                    {
                        field: 'tel',
                        title: '联系方式',
                        width: 150,
                        templet: function (d) {
                            return d.tel + '&nbsp;'
                        }
                    },
                    {
                        field: 'level',
                        title: '申请等级',
                        width: 150,
                        templet: function (d) {
                            if (d.level == "1") {
                                return "一级";
                            } else if (d.level == "2") {
                                return "二级";
                            } else if (d.level == "3") {
                                return "三级";
                            } else if (d.level == "4") {
                                return "四级";
                            } else if (d.level == "5") {
                                return "五级";
                            } else if (d.level == "6") {
                                return "六级";
                            } else if (d.level == "7") {
                                return "七级";
                            } else if (d.level == "8") {
                                return "八级";
                            } else if (d.level == "9") {
                                return "九级";
                            } else if (d.level == "10") {
                                return "十级";
                            } else {
                                return "";
                            }
                        }
                    },
                    {
                        field: 'status',
                        title: '审核结果',
                        width: 150,
                        templet: function (d) {
                            if (d.status == "1") {
                                return "等待审批"
                            } else if (d.status == "3") {
                                return "制证中"
                            } else if (d.status == "4") {
                                return "快递中"
                            } else if (d.status == "9") {
                                return "审核拒绝"
                            } else {
                                return ""
                            }
                        }
                    },

                    {
                        fixed: 'right',
                        title: "操作",
                        width: 150,
                        align: 'center',
                        toolbar: '#barDemo'
                    }
                ]
            ],
            id: 'testReload',
            done: function (res) {
                if (res.msg == "2") {
                    parent.window.location.href = getRequestPrefix() + "/footBallAdmin/login.html"
                }
                layer.close(index)
            }
        });

        // 审核状态 0审核中 1审核通过 2审核拒绝
        //头部输入框筛选功能
        var $ = layui.$,
            active = {

                reload: function () {

                    var name = $('#name').val();
                    var city = $("#s_province").val(); //城市
                    var area = $("#s_city").val(); //地区
                    var level = $("#level").val(); //申请等级
                    var fundStatus = $("#fundStatus").val(); //缴费状态
                    var startTime = $("#startTime").val(); //开始时间
                    var endTime = $("#endTime").val(); //结束时间
                    console.log(name, city, area, level, fundStatus, startTime, endTime, '输出查询的字段')
                    if (city == "地级市") {
                        city = ""
                    }
                    if (area == "地区") {
                        area = ""
                    }
                    // if((startTime == '' || startTime == null || startTime == undefined) && !endTime){
                    //     layer.msg('开始时间不能为空')
                    // }
                    // if((endTime == '' || endTime == null || endTime == undefined) && !startTime){
                    //     layer.msg('结束时间不能为空')
                    // }
                    // 执行重载（重新加载数据表格）
                    table.reload('testReload', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        },
                        where: {
                            "name": name,
                            "city": city,
                            "area": area,
                            "level": level,
                            "fundStatus": fundStatus,
                            "startTime": startTime,
                            "endTime": endTime
                        }
                    }, 'data');
                }
            };


        //给查询添加点击事件
        $('.search').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
            //一定要阻止表单的默认行为（刷新）
            return false
        });


        //监听头工具栏事件


        //监听点击的按钮，获取行信息
        table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            //获得当前行数据
            var $ = layui.$
            var data = obj.data,
                layEvent = obj.event; //获得 lay-event 对应的值
            // if (layEvent === 'detail') {
            //     // layer.msg('查看操作');
            //     layer.open({
            //         content:"car_detail.html",
            //         type:2,
            //         area:["400px","480px"],
            //         title:"车辆信息",
            //         // shade:true,
            //         shadeClose:true,
            //         success:function(layero,index){
            //             console.log(data)//获取点击行的数据
            //             var body = layer.getChildFrame('body', index);
            //             var iframeWin = window[layero.find('iframe')[0]['name']];
            //             body.find('.car_name').text(data.carName)
            //             body.find('.car_brand').text(data.carBrand)
            //             body.find('.car_type').text(data.carType)
            //             body.find('.car_num').text(data.carNumber)
            //             body.find('.car_driver').text(data.chauffeur)
            //             body.find('.driver_tel').text(data.chauffeurPhone)
            //             body.find('.car_code').text(data.carNo)
            //         }
            //     })
            //     // console.log(data)
            // } else
            if (layEvent === "edit1") {
                layer.open({
                    content: "approvalAdmission.html",
                    type: 2,
                    area: ["600px", "250px"],
                    title: "申请审批",
                    shadeClose: true,
                    success: function (layero, index) {
                        //获取点击行的数据,获取打开的iframe
                        console.log(data.id)
                        var body = layer.getChildFrame('body', index);
                        body.find('#id').attr("data-id", data.id); //填补ID
                    }
                })
            }
            if (layEvent === "edit3") {
                layer.open({
                    content: "consignment.html",
                    type: 2,
                    area: ["600px", "250px"],
                    title: "发货信息",
                    shadeClose: true,
                    success: function (layero, index) {
                        //获取点击行的数据,获取打开的iframe
                        console.log(data.id)
                        var body = layer.getChildFrame('body', index);
                        body.find('#id').attr("data-id", data.id); //填补ID
                    }
                })
            }
            if (layEvent === "edit4") {
                window.open(
                    "http://newtest.sdfa.org.cn/footballAssociation/user/level/certificateExportPdf?userId=" +
                    data.userId)

            }
        });


    });
</script>